package com.b2.controller.web;

import com.b2.pojo.dto.AbilityDto;
import com.b2.pojo.entity.Ability;
import com.b2.result.Result;
import com.b2.service.AbilityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/web/ability")
@Slf4j
@Api(tags = "能力" +
        "相关接口")
@CrossOrigin
public class AbilityController {




   @Autowired
   private AbilityService abilityService;

    @ApiOperation("查看绘本下的能力")
    @GetMapping("/check")
    public Result<List<Ability>> check(Long id) {
        return abilityService.check(id);
    }
    @ApiOperation("删除能力")
    @DeleteMapping("/delete")
    public Result delete(Long id) {
        return abilityService.delete(id);
    }
    @ApiOperation("添加能力")
    @PostMapping("/add")
    public Result add(@RequestBody AbilityDto abilityDto) {
        return abilityService.add(abilityDto);
    }
}
